package com.example.administrator.xxnapp.http;

import android.app.Dialog;

import com.example.administrator.xxnapp.util.des3.Des3;
import com.google.gson.Gson;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by Went_Gone on 2017/10/17.
 */

public abstract class CustomStringCallback extends StringCallback {
    private Dialog dialog;

    public CustomStringCallback() {
    }

    public CustomStringCallback(Dialog dialog) {
        this.dialog = dialog;
    }

    @Override
    public void onSuccess(Response<String> response) {
        Gson gson = new Gson();
        onSuccessString(gson,response.body());
    }

    public abstract void onSuccessString(Gson gson,String responseBody);

    @Override
    public void onFinish() {
        super.onFinish();
        if (dialog!=null && dialog.isShowing()){
            dialog.dismiss();
        }
    }
}
